<!doctype html>
<title>CSS Container Queries Test: Orthogonal writing-mode change in @container</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#size-container">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
  #container {
    container-type: size;
    width: 50vw;
    height: 50vh;
  }
  #orthogonal {
    font: 50px/1 Ahem;
  }
  @container (max-width: 100px) {
    #orthogonal {
      writing-mode: vertical-lr;
    }
  }
</style>
<div id="container">
  <div id="orthogonal">XX</div>
</div>
<script>
  setup(() => assert_implements_container_queries());

  test(() => {
    assert_equals(orthogonal.offsetWidth, container.offsetWidth);
  }, "Initial non-orthogonal width");

  test(() => {
    container.style.width = "100px";
    assert_equals(orthogonal.offsetWidth, 50);
    assert_not_equals(orthogonal.offsetWidth, container.offsetWidth);
  }, "Orthogonal width");
</script>
